<?php
	//message
	HtmlsHelper::Message($this->data['message']);
	
	XHTML::Form('', FormMethod::Post, array('id' => 'profileForm'));
	XHTML::InputHidden('id', HTTPContext::$session['client']['id']);
	echo "
        <table cellpadding='0' cellspacing='0' width='100%' style = 'margin-bottom: 3px; '>
          <tr class='lp1' name = 'staticRow'>
            <td align='left' class='tpad15 bpad15'><span class='c6a'>".Language::Get('First name')."*: </span></td>
            <td align='right'><span class='size14 tbold'>".$this->data[$this->name]['first_name']."</span></td>
          </tr>
          <tr class='lp1' name = 'inputRow' style = 'display: none; '>
		    <td colspan='2' class='bpad10 dq-input-text'>";
		    	XHTML::InputText('first_name', $this->data[$this->name]['first_name']);
	echo "	</td>
		  </tr>
		  </tr> 		  
          <tr class='lp1' name = 'staticRow'>
            <td align='left' class='bpad15 tpad15'><span class='c6a'>".Language::Get('Last name')."*: </span></td>
            <td align='right'><span class='size14 tbold'>{$this->data[$this->name]['last_name']}</span></td>
          </tr>
          <tr class='lp1' name = 'inputRow' style = 'display: none; '>
		    <td colspan='2' class='bpad10 dq-input-text'>";
		    	XHTML::InputText('last_name', $this->data[$this->name]['last_name']);
	echo "	</td>
		  </tr>
		  <tr class='lp1' name = 'staticRow'>
            <td align='left' class='bpad15 tpad15'><span class='c6a'>".Language::Get('Language')."*: </span></td>
            <td align='right'><span class='size14 tbold'>".$this->data['language']['name']."</span></td>
          </tr>
		  <tr class='lp1' name = 'inputRow' style = 'display: none; '>
		    <td colspan='2' class='bpad10 dq-input-text'>";
		    	XHTML::Select('language_id', $this->data['languages'], $this->data[$this->name]['language_id'], false, array('style' => 'border: 0px; width: 235px;'));
	echo "	</td>
		  </tr>
		  <tr class='lp1' name = 'staticRow'>
            <td align='left' class='bpad15 tpad15'><span class='c6a'>".Language::Get('Country')."*: </span></td>
            <td align='right'><span class='size14 tbold'>".$this->data['country']['name_'.Language::getShortName()]."</span></td>
          </tr>
          <tr class='lp1' name = 'inputRow' style = 'display: none; '>
		    <td colspan='2' class='bpad10 dq-input-text'>";
		    	XHTML::Select('country_id', $this->data['countries'], $this->data[$this->name]['country_id'], false, array('style' => 'border: 0px; width: 235px;'));
	echo "	</td>
		  </tr>
          <tr class='lp1' name = 'staticRow'>
            <td align='left' class='bpad15 tpad15'><span class='c6a'>".Language::Get('City')."*: </span></td>
            <td align='right'><span class='size14 tbold'>{$this->data[$this->name]['city']}</span></td>
          </tr>
          <tr class='lp1' name = 'inputRow' style = 'display: none; '>
		    <td colspan='2' class='bpad10 dq-input-text'>";
		    	XHTML::InputText('city', $this->data[$this->name]['city']);
	echo "	</td>
		  </tr>
          <tr class='lp1' name = 'staticRow'>
            <td align='left' class='bpad15 tpad15'><span class='c6a'>".Language::Get('Address').": </span></td>
            <td align='right'><span class='size14 tbold'>{$this->data[$this->name]['address']}</span></td>
          </tr>
          <tr class='lp1' name = 'inputRow' style = 'display: none; '>
		    <td colspan='2' class='bpad10 dq-input-text'>";
		    	XHTML::InputText('address', $this->data[$this->name]['address']);
	echo "	</td>
		  </tr>
          <tr class='lp1' name = 'staticRow'>
            <td align='left' class='bpad15 tpad15'><span class='c6a'>".Language::Get('Phones').": </span></td>
            <td align='right'><span class='size14 tbold'>{$this->data[$this->name]['phones']}</span></td>
          </tr>
          <tr class='lp1' name = 'inputRow' style = 'display: none; '>
		    <td colspan='2' class='bpad10 dq-input-text'>";
		    	XHTML::InputText('phones', $this->data[$this->name]['phones']);
	echo "	</td>
		  </tr>
        </table>
        <div class = 'c6a' style = 'margin-bottom: 10px; '>".Language::Get('Required fields')."</div>
        </form>
        
        <div id='btnEdit'>".Language::Get('Edit', 'CAPITALIZE')."</div>
        <table width = '100%'>
        	<tr>
	        	<td><div id='btnCancel' style = 'display: none; '>".Language::Get('Cancel', 'CAPITALIZE')."</div></td>
	        	<td><div id='btnSave' style = 'display: none; '>".Language::Get('Save', 'CAPITALIZE')."</div></td>
        	</tr>
        </table>
        
	";
?>

<script type="text/javascript">
	$('#btnEdit').dqButton({type:5, action:"EnterEditMode()", clickType:'js', live: false});
	$('#btnCancel').dqButton({type:3, action:"EnterViewMode()", clickType:'js', live: false});
	$('#btnSave').dqButton({type:5, action:"EnterSaveMode()", clickType:'js', live: false});
	$('.btnType-5-left').addClass('btnType-5-left-select');	
	$('.btnType-5-center').addClass('btnType-5-center-select');	
	$('.btnType-5-right').addClass('btnType-5-right-select');	
	$('.btnType-3-left').addClass('btnType-3-left-select');	
	$('.btnType-3-center').addClass('btnType-3-center-select');	
	$('.btnType-3-right').addClass('btnType-3-right-select');	
	$('.dq-input-text').dqInput();

	function EnterEditMode()
	{
		$('[name=staticRow]').attr('class', '');
		$('[name=staticRow] > td').attr('class', 'tpad5 bpad5');
		$('.size14.tbold').hide();
		$('[name=inputRow]').show();
		$('#btnEdit').hide();
		$('#btnCancel').show();
		$('#btnSave').show();
	}

	function EnterViewMode()
	{
		$('[name=staticRow]').attr('class', 'lp1');
		$('[name=staticRow] > td').attr('class', 'tpad15 bpad15');
		$('.size14.tbold').show();
		$('[name=inputRow]').hide();
		$('#btnEdit').show();
		$('#btnCancel').hide();
		$('#btnSave').hide();
	}
	
	function EnterSaveMode()
	{
		$('#profileForm').submit();
	}	
</script>